package com.chen.seckill.controller;


import com.chen.seckill.pojo.OrderDetailVo;
import com.chen.seckill.pojo.User;
import com.chen.seckill.resultvo.RespBean;
import com.chen.seckill.resultvo.RespBeanEnum;
import com.chen.seckill.service.IOrderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenyuan
 * @since 2021-07-21
 */
@Controller
@RequestMapping("/order")
public class OrderController {

    @Resource
    private IOrderService orderService;

    /**
     * 查询订单详情页信息
     * @param user
     * @param orderId
     * @return
     */
    @RequestMapping("/detail")
    @ResponseBody
    public RespBean detail(User user,Long orderId){

        if (user==null){
            return RespBean.error(RespBeanEnum.SESSION_ERROR);
        }
       OrderDetailVo orderDetailVo= orderService.detail(orderId);
        System.out.println(orderDetailVo);
        return RespBean.success(orderDetailVo);
    }

}
